package com.terracloud.server.dao.sql.tenant;

import com.terracloud.server.dao.model.sql.TenantGroupRelationEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.repository.query.Param;

import java.util.Collection;
import java.util.List;
import java.util.UUID;

/**
 *
 * @author chenhainan
 * @since 2025/10/11
 */
public interface TenantGroupRelationRepository extends JpaRepository<TenantGroupRelationEntity, UUID> {

    List<TenantGroupRelationEntity> findAllByTenantGroupId(@Param("tenantGroupId") UUID tenantGroupId);

    long countByTenantGroupId(@Param("tenantGroupId") UUID tenantGroupId);

    void deleteByTenantGroupId(@Param("tenantGroupId") UUID tenantGroupId);

    void removeAllByTenantGroupIdIsAndTenantIdIn(UUID tenantGroupId, Collection<UUID> tenantIds);

}
